package com.fastloan.common.datasource;

/**
 * @author chenkai
 * createTime 2017-12-2017/12/13 13:48
 */
public class DataSourceHolder {
    //线程本地环境
    private static final ThreadLocal<DynamicDataSourceGlobal> dataSources = new ThreadLocal<>();
    //设置数据源
    public static void setDataSource(DynamicDataSourceGlobal customerType) {
        dataSources.set(customerType);
    }
    //获取数据源
    public static DynamicDataSourceGlobal getDataSource() {
        return dataSources.get();
    }
    //清除数据源
    public static void clearDataSource() {
        dataSources.remove();
    }

}